package Excel.Model;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author lianghao
 * @create 2019-12-19 14:02
 */
public class WorkBookModel {
    private String fileName;
    private SheetModel[] sheetModels;
    private String useName;
    private boolean noSign;
    private String extendName;

    public WorkBookModel() {
        this.noSign = false;
        this.setExtendName("xlsx");
    }

    public String getFileName() {
        if (fileName != null && !fileName.isEmpty()) {
            fileName = fileName.replace(".xlsx","")
                    .replace(".xls","");
            if (!fileName.isEmpty()){
                SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");//设置日期格式
                return String.format("%s%s.%s", fileName, df.format(new Date()), this.getExtendName());
            }
            else
                return null;
        }
        else
            return null;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public SheetModel[] getSheetModels() {
        return sheetModels;
    }

    public void setSheetModels(SheetModel[] sheetModels) {
        this.sheetModels = sheetModels;
    }

    public String getUseName() {
        return useName;
    }

    public void setUseName(String useName) {
        this.useName = useName;
    }

    public boolean isNoSign() {
        return noSign;
    }

    public void setNoSign(boolean noSign) {
        this.noSign = noSign;
    }

    public String getExtendName() {
        return extendName;
    }

    public void setExtendName(String extendName) {
        this.extendName = extendName.replace(".","");
    }
}
